<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class RegisterRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //设置验证规则
            'email'=>'email|required',
            'password'=>'required',
            'repassword'=>'required|same:password',
            // 'code'=>'required'
        ];
    }

    //设置报错信息
    public function messages()
    {
        return [
            'email.email'=>'邮箱格式不正确',
            'email.required'=>'邮箱必须填写',
            'password.required'=>'密码必须填写',
            'repassword.required'=>'重复密码必须填写',
            'repassword.same'=>'两次输入不一致',
            // 'code.required'=>'验证码必须填写'
        ];
    }
}
